package fucai.com.fucai.ui;

import android.app.Activity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import java.util.LinkedList;

import fucai.com.fucai.DialogCreater.DialogCreater;

/**
 * 所有Activity的父类，提供一些公共函数
 */
public class BaseActivity extends AppCompatActivity /*implements MainUsedInterface.MainButtonClickListener*/ {
    /**
     * Manage dialog
     */
    public DialogCreater mDialogCreater = null;
    public ProgressDialog mDialog = null;
    /**
     * 标记是否可以显示Dilaog
     */
    private boolean isCanShowDialog = true;
    /**
     * 记录打开过的activity，便于处理推出程序功能
     */
    public static LinkedList<Activity> mAllActivitys = new LinkedList<Activity>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mDialog = new ProgressDialog(this);
        mDialog.setIndeterminate(true);
        mDialog.setCanceledOnTouchOutside(false);
        mAllActivitys.add(this);
    }

    @Override
    protected void onResume() {
        super.onResume();
        isCanShowDialog = true;
    }

    protected void onPause() {
        super.onPause();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mAllActivitys.remove(this);
    }

}
